#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

char *format_money(double money_double)
{
	char *money_str=NULL;
	assert (money_double<=999999999.99);
	if((money_str=(char *)malloc(13*sizeof(char)))==NULL)
	{
		perror("malloc error");
		exit(1);
	}
	sprintf(money_str,"%.2f",money_double);
	return money_str;
}

int main(int argc,char **argv)
{
	printf("%s\n",format_money(123456789.123));
	printf("%s\n",format_money(1023456789.123));
	return 0;
}
